namespace Asmex.FileViewer
{
    using System;
    using System.IO;

    public class MDBlob
    {
        public byte[] _data;
        private int _length;

        public MDBlob(BinaryReader reader)
        {
            this._length = MModule.DecodeInt32(reader);
            this._data = reader.ReadBytes(this._length);
        }

        public byte[] ToBytes()
        {
            return this._data;
        }

        public override string ToString()
        {
            int num = 0x20;
            if (this._length < num)
            {
                num = this._length;
            }
            string str = "";
            string str2 = "";
            for (int i = 0; i < num; i++)
            {
                str2 = str2 + this._data[i].ToString("X2") + " ";
                if ((this._data[i] >= 0x20) && (this._data[i] < 0x7f))
                {
                    str = str + ((char) this._data[i]);
                }
                else
                {
                    str = str + ".";
                }
            }
            if (this._length > 0x20)
            {
                str = str + "...";
                str2 = str2 + "...";
            }
            return str2;
        }

        public int Length
        {
            get
            {
                return this._length;
            }
        }
    }
}
